const url = window.location.href
const roles = [
  {
    key: 0,
    value: 'merchant',
    title: '商户端'
  },
  {
    key: 1,
    value: 'designer',
    title: '设计师端'
  },
  {
    key: 2,
    value: 'admin',
    title: '管理端'
  }
]
const localTarget = 2

function getRole() {
  if (url.indexOf('merchant.sjh') >= 0) {
    return roles[0]
  } else if (url.indexOf('designer.sjh') >= 0) {
    return roles[1]
  } else if (url.indexOf('admin.sjh') >= 0) {
    return roles[2]
  } else {
    return roles[localTarget]
  }
}

export function getUrlRole() {
  return getRole().key
}

export function getUrlRoleName() {
  return getRole().value
}

export function getRoleTitle() {
  return getRole().title
}
